package com.site.common.context;
import java.util.Properties;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;

 
/**
 * context相关变量初始化，通过spring赋值。
 * 
 * @author 刘圳
 * @date 2010-6-26
 * @version $Revision$
 */
public class CommonContextLoader implements ApplicationContextAware, InitializingBean {

	private ApplicationContext applicationContext;

	private Properties properties;

	public void setProperties(Properties properties) {
		this.properties = properties;
	}

	  
	public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
		this.applicationContext = applicationContext;
	}
 
	public void afterPropertiesSet() throws Exception {
		SpringContextHolder.setApplicationContext(applicationContext);
		PropsLoader.setProperties(properties);
	}
	

}